/*
 * The MIT License
 *
 * Copyright 2014 David Rodenas Pico.
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */

package edu.uoc.sd.fr14.model;

import edu.uoc.sd.fr14.actors.Cluster;
import edu.uoc.sd.fr14.actors.Server;

/**
 * This is an abstract server from which you have to inherit.
 * <p>
 * 
 * This server is an implementation of the actor server, but
 * it requires in their constructor some arguments that are
 * required to monitor satisfactorily the behaviour of your 
 * implementation.
 * <p>
 * 
 * Please make sure that:
 * - you in your implementation of the Server inherits from this class,
 * - implement a constructor with the same two arguments in the same order (no more) and,
 * - you provide the same two arguments to the super constructor for this class.
 * <p>
 * 
 * Use carefully serverState that it will use to validate your work.
 * Use cluster to communicate with other servers.
 * 
 * @author drodenas
 */
public abstract class AbstractServer implements Server {

    private final ServerState serverState;
    @SuppressWarnings("unused")
	private final Cluster cluster;

    /**
     * The constructor that you need to call
     * from your constructor with the same arguments in the same order.
     * 
     * @param serverState the state that you will use
     * @param cluster     the customer that let you to send messages to other machines
     */
    public AbstractServer(ServerState serverState, Cluster cluster) {
        this.serverState = serverState;
        this.cluster = cluster;
    }

    /**
     * An internal function to evaluate your implementation.
     * 
     * @return the new server state
     */
    public ServerState getServerState() {
        return serverState;
    }
    
}
